package cn.marinda.totipotentwar.utils;

import java.util.Calendar;
import java.util.Date;

/**
 * 时间工具类
 *
 * @author hwj
 * @date 2022/02/12
 */
public class TimeUtil {

    /**
     * 延迟时间
     *
     * @param delay 延迟
     * @return long
     */
    public static int delayTime(int delay){
        //当前时间
        long dateCurrent = System.currentTimeMillis() / 1000;
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.SECOND,delay);
        long delayTime = calendar.getTime().getTime() / 1000;
        long result = delayTime - dateCurrent;
        System.out.println("时间差： " + result);
        return (int)result;
    }

}
